package net.shopxx.common;

import net.shopxx.util.ArithUtil;

public class CommentUtil {
	
	private long total;
	private long bad;
	private long mid;
	private long good;
	public CommentUtil(long bad,long mid,long good,long total)
	{
		this.bad = bad;
		this.mid = mid;
		this.good = good;
		this.total = total;
	}
	
	public int getGoodDegree()
	{
		if(total==0)
			return 0;
		return ArithUtil.convertsToInt(ArithUtil.div(good,total,2)*100); 
	}
	
	public int getMidDegree()
	{
		if(total==0)
			return 0;
		return ArithUtil.convertsToInt(ArithUtil.div(mid,total,2)*100); 
	}
	
	public int getBadDegree()
	{
		if(total==0)
			return 0;
		return ArithUtil.convertsToInt(ArithUtil.div(bad,total,2)*100); 
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		CommentUtil instance = new CommentUtil(1L,2L,3L,6L);
		System.out.println("bad:"+instance.getBadDegree());

		System.out.println("mid:"+instance.getMidDegree());

		System.out.println("good:"+instance.getGoodDegree());

	}

}
